﻿using System;
using Cysharp.Threading.Tasks;

namespace Framework.Task
{
    public class Task_Exec : Task
    {
        private readonly Func<UniTask> onAction;
        
        public Task_Exec(int factor, Func<UniTask> action) : base(factor, "exec")
        {
            onAction = action;
        }

        protected override async UniTask OnStart()
        {
            if (onAction != null)
                await onAction();
            
            await OnFinished();
        }
    }
}